/*--------------------------------------------------------------------------------*/
#ifndef __DEFS__
#define __DEFS__
/*--------------------------------------------------------------------------------*/
#define DECLARE_SINGLETON( _CLASS_ )       	static REF Instance; \
                                            static _CLASS_ & GetInstance() { \
												return Instance.GetObject(); } \
                                            static VOID CreateInstance() { \
												_CLASS_::Instance.New(); } \
											static BOOL HasInstance() { \
												return !_CLASS_::Instance.IsNull() ; } \
											static VOID RemoveInstance() { \
												_CLASS_::Instance.SetNull() ; }


#define IMPLEMENT_SINGLETON( _CLASS_ )      _CLASS_::REF _CLASS_::Instance;

#define DECLARE_REF( _CLASS_ )          	typedef REF_TO_< _CLASS_ > REF; \
											virtual const CHAR * GetClassName() const \
											{ return #_CLASS_; }

#define OPENGL_Vertex2f( x, y ) 			glVertex2f( x, y )
#define OPENGL_Vertex( vector ) 			glVertex2f( vector.X, vector.Y )
#define OPENGL_Vertex3( vector ) 			glVertex3f( vector.X, vector.Y, vector.Z )
#define OPENGL_Color( color ) 				glColor4f( color.Red, color.Green, color.Blue, color.Alpha )
#define OPENGL_RotateX( angle )				glRotatef( angle, 1, 0, 0 )
#define OPENGL_RotateY( angle )				glRotatef( angle, 0, 1, 0 )
#define OPENGL_RotateZ( angle )				glRotatef( angle, 0, 0, 1 )
#define OPENGL_TranslateX( real )			glTranslatef( real, 0, 0 )
#define OPENGL_TranslateY( real )			glTranslatef( 0, real, 0 )
#define OPENGL_TranslateZ( real )			glTranslatef( 0, 0, real )
#define OPENGL_TranslateXY( x, y )			glTranslatef( x, y, 0 )
#define OPENGL_TranslateXYZ( x, y, z )		glTranslatef( x, y, z )
#define OPENGL_PushMatrix					glPushMatrix
#define OPENGL_PopMatrix					glPopMatrix
/*--------------------------------------------------------------------------------*/
#ifdef for_each
	#undef for_each
#endif

#define for_each_item( _INDEX_, _ARRAY_ )		for( _INDEX_ = 0; _INDEX_ < _ARRAY_.GetItemCount() ; ++_INDEX_ )

#define for_each_table_index( _INDEX_, _ARRAY_ )		for( _INDEX_ = 0; _INDEX_ < _ARRAY_.GetItemCount() ; ++_INDEX_ )

#define for_each_index( _INDEX_, _COUNT_ )		for( _INDEX_ = 0; _INDEX_ < _COUNT_ ; ++_INDEX_ )

#define for_each_index_in_range( _INDEX_, _START_, _END_ )		for( _INDEX_ = _START_; _INDEX_ <= _END_ ; ++_INDEX_ )
/*--------------------------------------------------------------------------------*/
#endif
